﻿using System;

class PrimeEnumeration
{
    static void Main()
    {
        Console.Write("请输入上限：");
        int upper = int.Parse(Console.ReadLine());
        Console.Write("请输入下限：");
        int lower = int.Parse(Console.ReadLine());

        if(upper < lower)
        {
            Console.WriteLine("输入错误");
            return;
        }

        List<int> primes = new List<int>();
        for (int i = lower;i <= upper;i++)
        {
            if (IsPrime(i)) primes.Add(i);
        }

        for (int i = 0; i < primes.Count; i += 10)
        {
            var group = primes.Skip(i).Take(10);
            Console.WriteLine(string.Join(" ", group));
        }
    }

    static bool IsPrime(int number)
    {
        if (number <= 1)
            return false;
        if (number == 2)
            return true;
        if (number % 2 == 0)
            return false;
        for (int i = 3; i * i <= number; i += 2)
        {
            if (number % i == 0)
                return false;
        }
        return true;
    }
}